Part Number Hot Search : 
SXX18 MIC29204 130094 HN62408 100E1 87V2104 HMETRI8 2SD1228
Product Description
Full Text Search
 

To Download ATM128 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1 features ? high-performance, low-power avr ? 8-bit microcontroller  advanced risc architecture ? 133 powerful instructions ? most single clock cycle execution ? 32 x 8 general purpose working registers + peripheral control registers ? fully static operation ? up to 16 mips throughput at 16 mhz ? on-chip 2-cycle multiplier  nonvolatile program and data memories ? 128k bytes of in-system reprogrammable flash endurance: 1,000 write/erase cycles ? optional boot code section with independent lock bits in-system programming by on-chip boot program true read-while-write operation ? 4k bytes eeprom endurance: 100,000 write/erase cycles ? 4k bytes internal sram ? up to 64k bytes optional external memory space ? programming lock for software security ? spi interface for in-system programming  jtag (ieee std. 1149.1 compliant) interface ? boundary-scan capabilities according to the jtag standard ? extensive on-chip debug support ? programming of flash, eeprom, fuses and lock bits through the jtag interface  peripheral features ? two 8-bit timer/counters with separate prescalers and compare modes ? two expanded 16-bit timer/counters with separate prescaler, compare mode and capture mode ? real time counter with separate oscillator ? two 8-bit pwm channels ? 6 pwm channels with programmable resolution from 1 to 16 bits ? 8-channel, 10-bit adc 8 single-ended channels 7 differential channels 2 differential channels with programmable gain (1x, 10x, 200x) ? byte-oriented 2-wire serial interface ? dual programmable serial usarts ? master/slave spi serial interface ? programmable watchdog timer with on-chip oscillator ? on-chip analog comparator  special microcontroller features ? power-on reset and programmable brown-out detection ? internal calibrated rc oscillator ? external and internal interrupt sources ? six sleep modes: idle, adc noise reduction, power-save, power-down, standby and extended standby ? software selectable clock frequency ? atmega103 compatibility mode selected by a fuse ? global pull-up disable  i/o and packages ? 53 programmable i/o lines ? 64-lead tqfp  operating voltages ? 2.7 - 5.5v (atmega128l) ? 4.5 - 5.5v (atmega128)  speed grades ? 0 - 8 mhz (atmega128l) ? 0 - 16 mhz (atmega128) rev. 2467as-08/01 8-bit microcontroller with 128k bytes in-system programmable flash atmega128 atmega128l preliminary summary n o t e: thi s i s a summary d ocume n t . a comp l e t e d ocumen t i s ava ila ble on ou r we b site at www.atmel.com .
2 atmega128(l) 2467as ? 08/01 pin configurations figure 1. pinout atmega128 overview the atmega128 is a low-power cmos 8-bit microcontroller based on the avr enhanced risc architecture. by executing powerful instructions in a single clock cycle, the atmega128 achieves throughputs approaching 1 mips per mhz allowing the sys- tem designer to optimize power consumption versus processing speed. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 pen rxd0/(pdi) pe0 (txd0/pdo) pe1 (xck0/ain0) pe2 (oc3a/ain1) pe3 (oc3b/int4) pe4 (oc3c/int5) pe5 (t3/int6) pe6 (ic3/int7) pe7 (ss) pb0 (sck) pb1 ( mosi) pb2 (miso) pb3 (oc0) pb4 (oc1a) pb5 (oc1b) pb6 pa3 (ad3) pa4 (ad4) pa5 (ad5) pa6 (ad6) pa7 (ad7) pg2(ale) pc7 (a15) pc6 (a14) pc5 (a13) pc4 (a12) pc3 (a11) pc2 (a10) pc1 (a9) pc0 (a8) pg1(rd) pg0(wr) 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 (oc2/oc1c) pb7 tosc2/pg3 tosc1/1pg4 reset vcc gnd xtal2 xtal1 (scl/int0) pd0 (sda/int1) pd1 (rxd1/int2) pd2 (txd1/int3) pd3 (ic1) pd4 (xck1) pd5 (t1) pd6 (t2) pd7 avcc gnd aref pf0 (adc0) pf1 (adc1) pf2 (adc2) pf3 (adc3) pf4 (adc4/tck) pf5 (adc5/tms) pf6 (adc6/tdo) pf7 (adc7/tdi) gnd vcc pa0 (ad0) pa1 (ad1) pa2 (ad2)
3 atmega128(l) 2467as ? 08/01 block diagram figure 2. block diagram program counter internal oscillator watchdog timer stack pointer program flash mcu control register sram general purpose registers instruction register timer/ counters instruction decoder data dir. reg. portb data dir. reg. porte data dir. reg. porta data dir. reg. portd data register portb data register porte data register porta data register portd timing and control oscillator oscillator interrupt unit eeprom spi usart0 status register z y x alu portb drivers porte drivers porta drivers portf drivers portd drivers portc drivers pb0 - pb7 pe0 - pe7 pa0 - pa7 pf0 - pf7 reset vcc agnd gnd aref xtal1 xtal2 control lines + - analog comp ara tor pc0 - pc7 8-bit data bus avcc usart1 calib. osc data dir. reg. portc data register portc on-chip debug jtag tap programming logic pen boundary- scan data dir. reg. portf data register portf adc pd0 - pd7 data dir. reg. portg data reg. portg portg drivers pg0 - pg4 2-wire serial interface
4 atmega128(l) 2467as ? 08/01 the avr core combines a rich instruction set with 32 general purpose working registers. all the 32 registers are directly connected to the arithmetic logic unit (alu), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. the resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional cisc microcontrollers. the atmega128 provides the following features: 128k bytes of in-system programma- ble flash with read-while-write capabilities, 4k bytes eeprom, 4k bytes sram, 53 general-purpose i/o lines, 32 general purpose working registers, real time counter (rtc), four flexible timer/counters with compare modes and pwm, 2 usarts, a byte oriented 2-wire serial interface, an 8-channel, 10-bit adc with optional differential input stage with programmable gain, programmable watchdog timer with internal oscillator, an spi serial port, ieee std. 1149.1 compliant jtag test interface, also used for accessing the on-chip debug system and programming and six software selectable power saving modes. the idle mode stops the cpu while allowing the sram, timer/counters, spi port, and interrupt system to continue functioning. the power-down mode saves the register contents but freezes the oscillator, disabling all other chip func- tions until the next interrupt or hardware reset. in power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. the adc noise reduction mode stops the cpu and all i/o modules except asynchronous timer and adc, to minimize switching noise during adc conver- sions. in standby mode, the crystal/resonator oscillator is running while the rest of the device is sleeping. this allows very fast start-up combined with low power consumption. in extended standby mode, both the main oscillator and the asynchronous timer con- tinue to run. the device is manufactured using atmel ? s high-density nonvolatile memory technology. the on-chip isp flash allows the program memory to be reprogrammed in-system through an spi serial interface, by a conventional nonvolatile memory programmer, or by an on-chip boot program running on the avr core. the boot program can use any interface to download the application program in the application flash memory. soft- ware in the boot flash section will continue to run while the application flash section is updated, providing true read-while-write operation. by combining an 8-bit risc cpu with in-system self-programmable flash on a monolithic chip, the atmel atmega128 is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications. the atmega128 avr is supported with a full suite of program and system development tools including: c compilers, macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits. atmega103 and atmega128 compatibility the atmega128 is a highly complex microcontroller where the number of i/o locations supersedes the 64 i/o location reserved in the avr instruction set. to ensure backward compatibility with the atmega103, all i/o locations present in atmega103 have the same location in atmega128. most additional i/o locations are added in an extended i/o space starting from $60 to $ff, (i.e., in the atmega103 internal ram space). these location can be reached by using ld/lds/ldd and st/sts/std instruction only, not by using in and out instruction. the relocation of the internal ram space may still be a problem for atmega103 users. also, the increased number of interrupt vectors might be a problem if the code uses absolute addresses. to solve these problems, an atmega103 compatibility mode can be selected by programming the fuse m103c. in this mode, none of the functions in the extended i/o space are in use, so the internal ram is located as in atmega103. also, the extended interrupt vectors are removed.
5 atmega128(l) 2467as ? 08/01 the atmega128 is 100% pin compatible with atmega103, and can replace the atmega103 on current printed circuit boards. the application note ? replacing atmega103 by atmega128 ? describes what the user should be aware of replacing the atmega103 by an atmega128. atmega103 compatibility mode by programming the m103c fuse, the atmega128 will be compatible with the atmega103 regards to ram, i/o pins and interrupt vectors as described above. how- ever, some new features in atmega128 are not available in this compatibility mode, these features are listed below:  one usart instead of two, asynchronous mode only. only the 8 least significant bits of the baud rate register is available.  one 16 bits timer/counter with 2 compare registers instead of two 16-bit timer/counters with 3 compare registers.  2-wire serial interface is not supported.  port g serves alternate functions only (not a general i/o port).  port f serves as digital input only in addition to analog input to the adc.  boot loader capabilities is not supported.  it is not possible to adjust the frequency of the internal calibrated rc oscillator.  the external memory interface can not release any address pins for general i/o, neither configure different wait-states to different external memory address sections. pin descriptions vcc digital supply voltage. gnd ground. port a (pa7..pa0) port a is an 8-bit bi-directional i/o port with internal pull-up resistors (selected for each bit). the port a output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port a pins that are externally pulled low will source current if the pull-up resistors are activated. the port a pins are tri-stated when a reset condition becomes active, even if the clock is not running. port a also serves the functions of various special features of the atmega128 as listed on page 68 . port b (pb7..pb0) port b is an 8-bit bi-directional i/o port with internal pull-up resistors (selected for each bit). the port b output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port b pins that are externally pulled low will source current if the pull-up resistors are activated. the port b pins are tri-stated when a reset condition becomes active, even if the clock is not running. port b also serves the functions of various special features of the atmega128 as listed on page 69 . port c (pc7..pc0) port c is an 8-bit bi-directional i/o port with internal pull-up resistors (selected for each bit). the port c output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port c pins that are externally pulled low will source current if the pull-up resistors are activated. the port c pins are tri-stated when a reset condition becomes active, even if the clock is not running.
6 atmega128(l) 2467as ? 08/01 port c also serves the functions of special features of the atmega128 as listed on page 72 . in atmega103 compatibility mode, port c is output only, and the port c pins are not tri-stated when a reset condition becomes active. port d (pd7..pd0) port d is an 8-bit bidirectional i/o port with internal pull-up resistors (selected for each bit). the port d output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port d pins that are externally pulled low will source current if the pull-up resistors are activated. the port d pins are tri-stated when a reset condition becomes active, even if the clock is not running. port d also serves the functions of various special features of the atmega128 as listed on page 73 . port e (pe7..pe0) port e is an 8-bit bidirectional i/o port with internal pull-up resistors (selected for each bit). the port e output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port e pins that are externally pulled low will source current if the pull-up resistors are activated. the port e pins are tri-stated when a reset condition becomes active, even if the clock is not running. port e also serves the functions of various special features of the atmega128 as listed on page 76 . port f (pf7..pf0) port f serves as the analog inputs to the a/d converter. port f also serves as an 8-bit bi-directional i/o port, if the a/d converter is not used. port pins can provide internal pull-up resistors (selected for each bit). the port f output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port f pins that are externally pulled low will source current if the pull-up resistors are activated. the port f pins are tri-stated when a reset condition becomes active, even if the clock is not running. if the jtag interface is enabled, the pull-up resis- tors on pins pf7(tdi), pf5(tms) and pf4(tck) will be activated even if a reset occurs. port f also serves the functions of the jtag interface. in atmega103 compatibility mode, port f is an input port only. port g (pg4..pg0) port g is a 5-bit bidirectional i/o port with internal pull-up resistors (selected for each bit). the port g output buffers have symmetrical drive characteristics with both high sink and source capability. as inputs, port g pins that are externally pulled low will source current if the pull-up resistors are activated. the port g pins are tri-stated when a reset condition becomes active, even if the clock is not running. port g also serves the functions of various special features. the port g pins are tri-stated when a reset condition becomes active, even if the clock is not running. in atmega103 compatibility mode, these pins only serves as strobes signals to the external memory as well as input to the 32 khz oscillator, and the pins are initialized to pg0 = 1, pg1 = 1, and pg2 = 0 asynchronously when a reset condition becomes active, even if the clock is not running. pg3 and pg4 are oscillator pins. reset reset input. a low level on this pin for longer than the minimum pulse length will gener- ate a reset, even if the clock is not running. the minimum pulse length is given in table 19 on page 46 . shorter pulses are not guaranteed to generate a reset. xtal1 input to the inverting oscillator amplifier and input to the internal clock operating circuit.
7 atmega128(l) 2467as ? 08/01 xtal2 output from the inverting oscillator amplifier. avcc this is the supply voltage pin for port f and the a/d converter. it should be externally connected to vcc, even if the adc is not used. if the adc is used, it should be con- nected to vcc through a low-pass filter. aref this is the analog reference pin for the a/d converter. pen this is a programming enable pin for the serial programming mode. by holding this pin low during a power-on reset, the device will enter the serial programming mode. pen has no function during normal operation.
8 atmega128(l) 2467as ? 08/01 register summary address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 page ($ff) reserved - - - - - - - - .. reserved - - - - - - - - ($9e) reserved - - - - - - - - ($9d) ucsr1c - umsel1 upm11 upm10 usbs1 ucsz11 ucsz10 ucpol1 185 ($9c) udr1 usart1 i/o data register 182 ($9b) ucsr1a rxc1 txc1 udre1 fe1 dor1 upe1 u2x1 mpcm1 183 ($9a) ucsr1b rxcie1 txcie1 udrie1 rxen1 txen1 ucsz12 rxb81 txb81 184 ($99) ubrr1l usart1 baud rate register low 186 ($98) ubrr1h - - - - usart1 baud rate register high 186 ($97) reserved - - - - - - - - ($96) reserved - - - - - - - - ($95) ucsr0c - umsel0 upm01 upm00 usbs0 ucsz01 ucsz00 ucpol0 185 ($94) reserved - - - - - - - - ($93) reserved - - - - - - - - ($92) reserved - - - - - - - - ($91) reserved - - - - - - - - ($90) ubrr0h - - - - usart0 baud rate register high 186 ($8f) reserved - - - - - - - - ($8e) reserved - - - - - - - - ($8d) reserved - - - - - - - - ($8c) tccr3c foc3a foc3b foc3c - - - - -132 ($8b) tccr3a com3a1 com3a0 com3b1 com3b0 com3c1 com3c0 wgm31 wgm30 127 ($8a) tccr3b icnc3 ices3 - wgm33 wgm32 cs32 cs31 cs30 130 ($89) tcnt3h timer/counter3 - counter register high byte 132 ($88) tcnt3l timer/counter3 - counter register low byte 132 ($87) ocr3ah timer/counter3 - output compare register a high byte 133 ($86) ocr3al timer/counter3 - output compare register a low byte 133 ($85) ocr3bh timer/counter3 - output compare register b high byte 133 ($84) ocr3bl timer/counter3 - output compare register b low byte 133 ($83) ocr3ch timer/counter3 - output compare register c high byte 133 ($82) ocr3cl timer/counter3 - output compare register c low byte 133 ($81) icr3h timer/counter3 - input capture register high byte 134 ($80) icr3l timer/counter3 - input capture register low byte 134 ($7f) reserved - - - - - - - - ($7e) reserved - - - - - - - - ($7d) etimsk - - ticie3 ocie3a ocie3b toie3 ocie3c ocie1c 135 ($7c) etifr - - icf3 ocf3a ocf3b tov3 ocf3c ocf1c 136 ($7b) reserved - - - - - - - - ($7a) tccr1c foc1a foc1b foc1c - - - - -131 ($79) ocr1ch timer/counter1 - output compare register c high byte 133 ($78) ocr1cl timer/counter1 - output compare register c low byte 133 ($77) reserved - - - - - - - - ($76) reserved - - - - - - - - ($75) reserved - - - - - - - - ($74) twcr twint twea twsta twsto twwc twen -twie 198 ($73) twdr 2-wire serial interface data register 199 ($72) twar twa6 twa5 twa4 twa3 twa2 twa1 twa0 twgce 200 ($671 twsr tws7 tws6 tws5 tws4 tws3 - twps1 twps0 199 ($70) twbr 2-wire serial interface bit rate register 197 ($6f) osccal oscillator calibration register 38 ($6e) reserved - - - - - - - - ($6d) xmcra - srl2 srl1 srl0 srw01 srw00 srw11 29 ($6c) xmcrb xmbk - - - - xmm2 xmm1 xmm0 31 ($6b) reserved - - - - - - - - ($6a) eicra isc31 isc30 isc21 isc20 isc11 isc10 isc01 isc00 84 ($69) reserved - - - - - - - - ($68) spmcsr spmie rwwsb - rwwsre blbset pgwrt pgers spmen 270 ($67) reserved - - - - - - - - ($66) reserved - - - - - - - - ($65) portg - - - portg4 portg3 portg2 portg1 portg0 83 ($64) ddrg - - - ddg4 ddg3 ddg2 ddg1 ddg0 83 ($63) ping - - - ping4 ping3 ping2 ping1 ping0 83 ($62) portf portf7 portf6 portf5 portf4 portf3 portf2 portf1 portf0 83
9 atmega128(l) 2467as ? 08/01 ($61) ddrf ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 83 ($60) reserved - - - - - - - - $3f ($5f) sreg i t h s v n z c 9 $3e ($5e) sph sp15 sp14 sp13 sp12 sp11 sp10 sp9 sp8 12 $3d ($5d) spl sp7 sp6 sp5 sp4 sp3 sp2 sp1 sp0 12 $3c ($5c) xdiv xdiven xdiv6 xdiv5 xdiv4 xdiv3 xdiv2 xdiv1 xdiv0 39 $3b ($5b) rampz - - - - - - - rampz0 12 $3a ($5a) eicrb isc71 isc70 isc61 isc60 isc51 isc50 isc41 isc40 85 $39 ($59) eimsk int7 int6 int5 int4 int3 int2 int1 int0 86 $38 ($58) eifr intf7 intf6 intf5 intf4 intf3 intf intf1 intf0 86 $37 ($57) timsk ocie2 toie2 ticie1 ocie1a ocie1b toie1 ocie0 toie0 103, 134, 153 $36 ($56) tifr ocf2 tov2 icf1 ocf1a ocf1b tov1 ocf0 tov0 103, 136, 154 $35 ($55) mcucr sre srw10 se sm1 sm0 sm2 ivsel ivce 29, 41, 58 $34 ($54) mcucsr jtd - - jtrf wdrf borf extrf porf 49, 246 $33 ($53) tccr0 foc0 wgm00 com01 com00 wgm01 cs02 cs01 cs00 98 $32 ($52) tcnt0 timer/counter0 (8 bit) 100 $31 ($51) ocr0 timer/counter0 output compare register 100 $30 ($50) assr - - - - as0 tcn0ub ocr0ub tcr0ub 101 $2f ($4f) tccr1a com1a1 com1a0 com1b1 com1b0 com1c1 com1c0 wgm11 wgm10 127 $2e ($4e) tccr1b icnc1 ices1 - wgm13 wgm12 cs12 cs11 cs10 130 $2d ($4d) tcnt1h timer/counter1 - counter register high byte 132 $2c ($4c) tcnt1l timer/counter1 - counter register low byte 132 $2b ($4b) ocr1ah timer/counter1 - output compare register a high byte 133 $2a ($4a) ocr1al timer/counter1 - output compare register a low byte 133 $29 ($49) ocr1bh timer/counter1 - output compare register b high byte 133 $28 ($48) ocr1bl timer/counter1 - output compare register b low byte 133 $27 ($47) icr1h timer/counter1 - input capture register high byte 134 $26 ($46) icr1l timer/counter1 - input capture register low byte 134 $25 ($45) tccr2 foc2 wgm20 com21 com20 wgm21 cs22 cs21 cs20 151 $24 ($44) tcnt2 timer/counter2 (8 bit) 153 $23 ($43) ocr2 timer/counter2 output compare register 153 $22 ($42) ocdr idrd/ ocdr7 ocdr6 ocdr5 ocdr4 ocdr3 ocdr2 ocdr1 ocdr0 242 $21 ($41) wdtcr - - - wdce wde wdp2 wdp1 wdp0 51 $20 ($40) sfior tsm - - adhsm acme pud psr0 psr321 67, 104, 139, 237 $1f ($3f) eearh - - - - eeprom address register high 19 $1e ($3e) eearl eeprom address register low byte 19 $1d ($3d) eedr eeprom data register 20 $1c ($3c) eecr - - - - eerie eemwe eewe eere 20 $1b ($3b) porta porta7 porta6 porta5 porta4 porta3 porta2 porta1 porta0 81 $1a ($3a) ddra dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 81 $19 ($39) pina pina7 pina6 pina5 pina4 pina3 pina2 pina1 pina0 81 $18 ($38) portb portb7 portb6 portb5 portb4 portb3 portb2 portb1 portb0 81 $17 ($37) ddrb ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 81 $16 ($36) pinb pinb7 pinb6 pinb5 pinb4 pinb3 pinb2 pinb1 pinb0 82 $15 ($35) portc portc7 portc6 portc5 portc4 portc3 portc2 portc1 portc0 82 $14 ($34) ddrc ddc7 ddc6 ddc5 ddc4 ddc3 ddc2 ddc1 ddc0 82 $13 ($33) pinc pinc7 pinc6 pinc5 pinc4 pinc3 pinc2 pinc1 pinc0 82 $12 ($32) portd portd7 portd6 portd5 portd4 portd3 portd2 portd1 portd0 82 $11 ($31) ddrd ddd7 ddd6 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 82 $10 ($30) pind pind7 pind6 pind5 pind4 pind3 pind2 pind1 pind0 82 $0f ($2f) spdr spi data register 163 $0e ($2e) spsr spif wcol - - - - -spi2x 162 $0d ($2d) spcr spie spe dord mstr cpol cpha spr1 spr0 161 $0c ($2c) udr0 usart0 i/o data register 182 $0b ($2b) ucsr0a rxc0 txc0 udre0 fe0 dor0 upe0 u2x0 mpcm0 183 $0a ($2a) ucsr0b rxcie0 txcie0 udrie0 rxen0 txen0 ucsz02 rxb80 txb80 184 $09 ($29) ubrr0l usart0 baud rate register low 186 $08 ($28) acsr acd acbg aco aci acie acic acis1 acis0 218 $07 ($27) admux refs1 refs0 adlar mux4 mux3 mux2 mux1 mux0 233 $06 ($26) adcsra aden adsc adrf adif adie adps2 adps1 adps0 235 $05 ($25) adch adc data register high byte 236 $04 ($24) adcl adc data register low byte 236 $03 ($23) porte porte7 porte6 porte5 porte4 porte3 porte2 porte1 porte0 82 $02 ($22) ddre dde7 dde6 dde5 dde4 dde3 dde2 dde1 dde0 83 register summary (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 page
10 atmega128(l) 2467as ? 08/01 notes: 1. for compatibility with future devices, reserved bits should be written to zero if accessed. reserved i/o memory address es should never be written. 2. some of the status flags are cleared by writing a logical one to them. note that the cbi and sbi instructions will operate on all bits in the i/o register, writing a one back into any flag read as set, thus clearing the flag. the cbi and sbi instruction s work with registers $00 to $1f only. $01 ($21) pine pine7 pine6 pine5 pine4 pine3 pine2 pine1 pine0 83 $00 ($20) pinf pinf7 pinf6 pinf5 pinf4 pinf3 pinf2 pinf1 pinf0 83 register summary (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 page
11 atmega128(l) 2467as ? 08/01 instruction set summary mnemonics operands description operation flags #clocks arithmetic and logic instructions add rd, rr add two registers rd rd + rr z,c,n,v,h 1 adc rd, rr add with carry two registers rd rd + rr + c z,c,n,v,h 1 adiw rdl,k add immediate to word rdh:rdl rdh:rdl + k z,c,n,v,s 2 sub rd, rr subtract two registers rd rd - rr z,c,n,v,h 1 subi rd, k subtract constant from register rd rd - k z,c,n,v,h 1 sbc rd, rr subtract with carry two registers rd rd - rr - c z,c,n,v,h 1 sbci rd, k subtract with carry constant from reg. rd rd - k - c z,c,n,v,h 1 sbiw rdl,k subtract immediate from word rdh:rdl rdh:rdl - k z,c,n,v,s 2 and rd, rr logical and registers rd rd ? rr z,n,v 1 andi rd, k logical and register and constant rd rd ? kz,n,v1 or rd, rr logical or registers rd rd v rr z,n,v 1 ori rd, k logical or register and constant rd rd v k z,n,v 1 eor rd, rr exclusive or registers rd rd rr z,n,v 1 com rd one ? s complement rd $ff ? rd z,c,n,v 1 neg rd two ? s complement rd $00 ? rd z,c,n,v,h 1 sbr rd,k set bit(s) in register rd rd v k z,n,v 1 cbr rd,k clear bit(s) in register rd rd ? ($ff - k) z,n,v 1 inc rd increment rd rd + 1 z,n,v 1 dec rd decrement rd rd ? 1 z,n,v 1 tst rd test for zero or minus rd rd ? rd z,n,v 1 clr rd clear register rd rd rd z,n,v 1 ser rd set register rd $ff none 1 mul rd, rr multiply unsigned r1:r0 rd x rr z,c 2 muls rd, rr multiply signed r1:r0 rd x rr z,c 2 mulsu rd, rr multiply signed with unsigned r1:r0 rd x rr z,c 2 fmul rd, rr fractional multiply unsigned r1:r0 (rd x rr) << 1 z,c 2 fmuls rd, rr fractional multiply signed r1:r0 (rd x rr) << 1 z,c 2 fmulsu rd, rr fractional multiply signed with unsigned r1:r0 (rd x rr) << 1 z,c 2 branch instructions rjmp k relative jump pc pc + k + 1 none 2 ijmp indirect jump to (z) pc z none 2 jmp k direct jump pc k none 3 rcall k relative subroutine call pc pc + k + 1 none 3 icall indirect call to (z) pc z none 3 call k direct subroutine call pc k none 4 ret subroutine return pc stack none 4 reti interrupt return pc stack i 4 cpse rd,rr compare, skip if equal if (rd = rr) pc pc + 2 or 3 none 1 / 2 / 3 cp rd,rr compare rd ? rr z, n,v,c,h 1 cpc rd,rr compare with carry rd ? rr ? c z, n,v,c,h 1 cpi rd,k compare register with immediate rd ? k z, n,v,c,h 1 sbrc rr, b skip if bit in register cleared if (rr(b)=0) pc pc + 2 or 3 none 1 / 2 / 3 sbrs rr, b skip if bit in register is set if (rr(b)=1) pc pc + 2 or 3 none 1 / 2 / 3 sbic p, b skip if bit in i/o register cleared if (p(b)=0) pc pc + 2 or 3 none 1 / 2 / 3 sbis p, b skip if bit in i/o register is set if (p(b)=1) pc pc + 2 or 3 none 1 / 2 / 3 brbs s, k branch if status flag set if (sreg(s) = 1) then pc pc+k + 1 none 1 / 2 brbc s, k branch if status flag cleared if (sreg(s) = 0) then pc pc+k + 1 none 1 / 2 breq k branch if equal if (z = 1) then pc pc + k + 1 none 1 / 2 brne k branch if not equal if (z = 0) then pc pc + k + 1 none 1 / 2 brcs k branch if carry set if (c = 1) then pc pc + k + 1 none 1 / 2 brcc k branch if carry cleared if (c = 0) then pc pc + k + 1 none 1 / 2 brsh k branch if same or higher if (c = 0) then pc pc + k + 1 none 1 / 2 brlo k branch if lower if (c = 1) then pc pc + k + 1 none 1 / 2 brmi k branch if minus if (n = 1) then pc pc + k + 1 none 1 / 2 brpl k branch if plus if (n = 0) then pc pc + k + 1 none 1 / 2 brge k branch if greater or equal, signed if (n v= 0) then pc pc + k + 1 none 1 / 2 brlt k branch if less than zero, signed if (n v= 1) then pc pc + k + 1 none 1 / 2 brhs k branch if half carry flag set if (h = 1) then pc pc + k + 1 none 1 / 2 brhc k branch if half carry flag cleared if (h = 0) then pc pc + k + 1 none 1 / 2 brts k branch if t flag set if (t = 1) then pc pc + k + 1 none 1 / 2 brtc k branch if t flag cleared if (t = 0) then pc pc + k + 1 none 1 / 2 brvs k branch if overflow flag is set if (v = 1) then pc pc + k + 1 none 1 / 2 brvc k branch if overflow flag is cleared if (v = 0) then pc pc + k + 1 none 1 / 2
12 atmega128(l) 2467as ? 08/01 mnemonics operands description operation flags #clocks brie k branch if interrupt enabled if ( i = 1) then pc pc + k + 1 none 1 / 2 brid k branch if interrupt disabled if ( i = 0) then pc pc + k + 1 none 1 / 2 data transfer instructions mov rd, rr move between registers rd rr none 1 movw rd, rr copy register word rd+1:rd rr+1:rr none 1 ldi rd, k load immediate rd k none 1 ld rd, x load indirect rd (x) none 2 ld rd, x+ load indirect and post-inc. rd (x), x x + 1 none 2 ld rd, - x load indirect and pre-dec. x x - 1, rd (x) none 2 ld rd, y load indirect rd (y) none 2 ld rd, y+ load indirect and post-inc. rd (y), y y + 1 none 2 ld rd, - y load indirect and pre-dec. y y - 1, rd (y) none 2 ldd rd,y+q load indirect with displacement rd (y + q) none 2 ld rd, z load indirect rd (z) none 2 ld rd, z+ load indirect and post-inc. rd (z), z z+1 none 2 ld rd, -z load indirect and pre-dec. z z - 1, rd (z) none 2 ldd rd, z+q load indirect with displacement rd (z + q) none 2 lds rd, k load direct from sram rd (k) none 2 st x, rr store indirect (x) rr none 2 st x+, rr store indirect and post-inc. (x) rr, x x + 1 none 2 st - x, rr store indirect and pre-dec. x x - 1, (x) rr none 2 st y, rr store indirect (y) rr none 2 st y+, rr store indirect and post-inc. (y) rr, y y + 1 none 2 st - y, rr store indirect and pre-dec. y y - 1, (y) rr none 2 std y+q,rr store indirect with displacement (y + q) rr none 2 st z, rr store indirect (z) rr none 2 st z+, rr store indirect and post-inc. (z) rr, z z + 1 none 2 st -z, rr store indirect and pre-dec. z z - 1, (z) rr none 2 std z+q,rr store indirect with displacement (z + q) rr none 2 sts k, rr store direct to sram (k) rr none 2 lpm load program memory r0 (z) none 3 lpm rd, z load program memory rd (z) none 3 lpm rd, z+ load program memory and post-inc rd (z), z z+1 none 3 elpm extended load program memory r0 (rampz:z) none 3 elpm rd, z extended load program memory rd (rampz:z) none 3 elpm rd, z+ extended load program memory and post-inc rd (rampz:z), rampz:z rampz:z+1 none 3 spm store program memory (z) r1:r0 none - in rd, p in port rd p none 1 out p, rr out port p rr none 1 push rr push register on stack stack rr none 2 pop rd pop register from stack rd stack none 2 bit and bit-test instructions sbi p,b set bit in i/o register i/o(p,b) 1 none 2 cbi p,b clear bit in i/o register i/o(p,b) 0 none 2 lsl rd logical shift left rd(n+1) rd(n), rd(0) 0 z,c,n,v 1 lsr rd logical shift right rd(n) rd(n+1), rd(7) 0 z,c,n,v 1 rol rd rotate left through carry rd(0) c,rd(n+1) rd(n),c rd(7) z,c,n,v 1 ror rd rotate right through carry rd(7) c,rd(n) rd(n+1),c rd(0) z,c,n,v 1 asr rd arithmetic shift right rd(n) rd(n+1), n=0..6 z,c,n,v 1 swap rd swap nibbles rd(3..0) rd(7..4),rd(7..4) rd(3..0) none 1 bset s flag set sreg(s) 1 sreg(s) 1 bclr s flag clear sreg(s) 0 sreg(s) 1 bst rr, b bit store from register to t t rr(b) t 1 bld rd, b bit load from t to register rd(b) t none 1 sec set carry c 1c1 clc clear carry c 0 c 1 sen set negative flag n 1n1 cln clear negative flag n 0 n 1 sez set zero flag z 1z1 clz clear zero flag z 0 z 1 sei global interrupt enable i 1i1 cli global interrupt disable i 0 i 1 ses set signed test flag s 1s1 cls clear signed test flag s 0 s 1 instruction set summary (continued)
13 atmega128(l) 2467as ? 08/01 mnemonics operands description operation flags #clocks sev set twos complement overflow. v 1v1 clv clear twos complement overflow v 0 v 1 set set t in sreg t 1t1 clt clear t in sreg t 0 t 1 seh set half carry flag in sreg h 1h1 clh clear half carry flag in sreg h 0 h 1 mcu control instructions nop no operation none 1 sleep sleep (see specific descr. for sleep function) none 1 wdr watchdog reset (see specific descr. for wdr/timer) none 1 break break for on-chip debug only none n/a instruction set summary (continued)
14 atmega128(l) 2467as ? 08/01 ordering information speed (mhz) power supply ordering code package operation range 8 2.7 - 5.5v atmega128-8ac 64a commercial (0 o c to 70 o c) atmega128-8ai 64a industrial (-40 o c to 85 o c) 16 4.5 - 5.5v atmega128-16ac 64a commercial (0 o c to 70 o c) atmega128-16ai 64a industrial (-40 o c to 85 o c) package type 64a 64-lead, thin (1.0 mm) plastic gull wing quad flat package (tqfp)
15 atmega128(l) 2467as ? 08/01 packaging information 64a pin 1 id 0.80(0.0315) bsc 16.25(0.640) sq sq 15.75(0.620) 0.45(0.018) 0.30(0.012) 14.10(0.555) 13.90(0.547) 0.15(0.006) 0.05(0.002 ) 0.75(0.030) 0.45(0.018) 0.20(0.008) 0.09(0.004) pin 1 64-lead, thin (1.0 mm) plastic quad flat package (tqfp), 14x14mm body, 2.0mm footprint, 0.8mm pitch. dimensions in millimeters and (inches)* jedec standard ms-026 aeb *controlliing dimension: millimeter 0?~7? 1.20 (0.047) max rev. a 04/11/2001
? atmel corporation 2001. atmel corporation makes no warranty for the use of its products, other than those expressly contained in the company s standard warranty which is detailed in atmel s terms and conditions located on the company s web site. the company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without n otice, and does not make any commitment to update the information contained herein. no licenses to patents or other intellectual property of at mel are granted by the company in connection with the sale of atmel products, expressly or by implication. atmel s products are not authorized for use as critical components in life support devices or systems. atmel headquarters atmel product operations corporate headquarters 2325 orchard parkway san jose, ca 95131 tel (408) 441-0311 fax (408) 487-2600 europe atmel sarl route des arsenaux 41 casa postale 80 ch-1705 fribourg switzerland tel (41) 26-426-5555 fax (41) 26-426-5500 asia atmel asia, ltd. room 1219 chinachem golden plaza 77 mody road tsimhatsui east kowloon hong kong tel (852) 2721-9778 fax (852) 2722-1369 japan atmel japan k.k. 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel (81) 3-3523-3551 fax (81) 3-3523-7581 atmel colorado springs 1150 e. cheyenne mtn. blvd. colorado springs, co 80906 tel (719) 576-3300 fax (719) 540-1759 atmel grenoble avenue de rochepleine bp 123 38521 saint-egreve cedex, france tel (33) 4-7658-3000 fax (33) 4-7658-3480 atmel heilbronn theresienstrasse 2 pob 3535 d-74025 heilbronn, germany tel (49) 71 31 67 25 94 fax (49) 71 31 67 24 23 atmel nantes la chantrerie bp 70602 44306 nantes cedex 3, france tel (33) 0 2 40 18 18 18 fax (33) 0 2 40 18 19 60 atmel rousset zone industrielle 13106 rousset cedex, france tel (33) 4-4253-6000 fax (33) 4-4253-6001 atmel smart card ics scottish enterprise technology park east kilbride, scotland g75 0qr tel (44) 1355-357-000 fax (44) 1355-242-743 e-mail literature@atmel.com web site http://www.atmel.com bbs 1-(408) 436-4309 printed on recycled paper. 2467as 08/01 atmel , avr and avr studio are the registered trademarks of atmel. microsoft , windows and windows nt are the registered trademarks of microsoft corporation. other terms and product names may be the trademarks of others.


▲Up To Search▲   

 
Price & Availability of ATM128

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X